package com.nidu.demo.oauth2;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.nidu.demo.oauth2.dto.OAuth2CodePageQry;
import com.nidu.demo.oauth2.api.OAuth2CodeService;
import com.nidu.demo.oauth2.dto.OAuth2CodeCO;
import com.nidu.demo.oauth2.executor.command.OAuth2CodeDeleteCmdExe;
import com.nidu.demo.oauth2.executor.query.OAuth2CodePageQryExe;
import com.nidu.demo.oauth2.executor.query.OAuth2CodeSingleQryExe;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Set;

@Service
@RequiredArgsConstructor
public class OAuth2CodeServiceImpl implements OAuth2CodeService {

    private final OAuth2CodeDeleteCmdExe deleteCmdExe;
    private final OAuth2CodeSingleQryExe singleQryExe;
    private final OAuth2CodePageQryExe pageQryExe;

    @Override
    public Response delete(Long id) {
        return deleteCmdExe.execute(id);
    }

    @Override
    public Response delete(Set<Long> ids) {
        return deleteCmdExe.execute(ids);
    }

    @Override
    public SingleResponse<OAuth2CodeCO> getById(Long id) {
        return singleQryExe.execute(id);
    }

    @Override
    public PageResponse<OAuth2CodeCO> page(OAuth2CodePageQry pageQry) {
        return pageQryExe.execute(pageQry);
    }
}
